package com.example.lianxi222.fragment.home;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.example.mvvm_base.base.viewmodel.BaseViewModel;
import com.example.mvvm_base.userbean.BannerEntity;
import com.example.mvvm_base.userbean.LikeEntity;
import com.example.mvvm_base.userbean.VideoEntity;

public class HomeViewModel extends BaseViewModel<HomeRepo> {
    MutableLiveData<BannerEntity> bannerSuccess=new MutableLiveData<>();
    MutableLiveData<String> bannerFailure=new MutableLiveData<>();
    MutableLiveData<VideoEntity> videoSuccess=new MutableLiveData<>();
    MutableLiveData<String> videoFailure=new MutableLiveData<>();
    MutableLiveData<LikeEntity> likeSuccess=new MutableLiveData<>();
    MutableLiveData<String> likeFailure=new MutableLiveData<>();
    MutableLiveData<LikeEntity> unLikeSuccess=new MutableLiveData<>();
    MutableLiveData<String> unLikeFailure=new MutableLiveData<>();
    public HomeViewModel(@NonNull Application application) {
        super(application);
    }
  public void getBannerData(){
        repo.getBannerData(bannerSuccess,bannerFailure);
  }
  public void getVideoData(){
        repo.getVideoData(1,10,videoSuccess,videoFailure);
  }
  public void like(int id){
        repo.like(id,likeSuccess,likeFailure);
  }
  public void unLike(int id){
        repo.unLike(id,unLikeSuccess,unLikeFailure);
  }
    @Override
    protected HomeRepo createRepo() {
        return new HomeRepo();
    }
}
